package cn.iocoder.yudao.module.fm.dal.mysql.bridge;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.fm.dal.dataobject.subgrade.SubgradeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.fm.controller.admin.subgrade.vo.*;

/**
 * 桥梁 Mapper
 *
 * @author 档案
 */
@Mapper
public interface SubgradeMapper extends BaseMapperX<SubgradeDO> {

    default PageResult<SubgradeDO> selectPage(SubgradePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SubgradeDO>()
                .likeIfPresent(SubgradeDO::getMileage, reqVO.getMileage())
                .likeIfPresent(SubgradeDO::getPacking, reqVO.getPacking())
                .likeIfPresent(SubgradeDO::getBasementLithology, reqVO.getBasementLithology())
                .likeIfPresent(SubgradeDO::getLength, reqVO.getLength())
                .likeIfPresent(SubgradeDO::getWidth, reqVO.getWidth())
                .likeIfPresent(SubgradeDO::getTimeOfFilling, reqVO.getTimeOfFilling())
                .likeIfPresent(SubgradeDO::getFeatures, reqVO.getFeatures())
                .likeIfPresent(SubgradeDO::getDiseaseAndDisease, reqVO.getDiseaseAndDisease())
                .likeIfPresent(SubgradeDO::getTeamLeaderOfSubgradeClass, reqVO.getTeamLeaderOfSubgradeClass())
                .likeIfPresent(SubgradeDO::getDeputyManager, reqVO.getDeputyManager())
                .likeIfPresent(SubgradeDO::getTechnician, reqVO.getTechnician())
                .likeIfPresent(SubgradeDO::getMonitorOfSurvey, reqVO.getMonitorOfSurvey())
                .likeIfPresent(SubgradeDO::getEngineerOfSupervision, reqVO.getEngineerOfSupervision())
                .betweenIfPresent(SubgradeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SubgradeDO::getId));
    }

    default List<SubgradeDO> selectList(SubgradeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<SubgradeDO>()
                .likeIfPresent(SubgradeDO::getMileage, reqVO.getMileage())
                .likeIfPresent(SubgradeDO::getPacking, reqVO.getPacking())
                .likeIfPresent(SubgradeDO::getBasementLithology, reqVO.getBasementLithology())
                .likeIfPresent(SubgradeDO::getLength, reqVO.getLength())
                .likeIfPresent(SubgradeDO::getWidth, reqVO.getWidth())
                .likeIfPresent(SubgradeDO::getTimeOfFilling, reqVO.getTimeOfFilling())
                .likeIfPresent(SubgradeDO::getFeatures, reqVO.getFeatures())
                .likeIfPresent(SubgradeDO::getDiseaseAndDisease, reqVO.getDiseaseAndDisease())
                .likeIfPresent(SubgradeDO::getTeamLeaderOfSubgradeClass, reqVO.getTeamLeaderOfSubgradeClass())
                .likeIfPresent(SubgradeDO::getDeputyManager, reqVO.getDeputyManager())
                .likeIfPresent(SubgradeDO::getTechnician, reqVO.getTechnician())
                .likeIfPresent(SubgradeDO::getMonitorOfSurvey, reqVO.getMonitorOfSurvey())
                .likeIfPresent(SubgradeDO::getEngineerOfSupervision, reqVO.getEngineerOfSupervision())
                .betweenIfPresent(SubgradeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SubgradeDO::getId));
    }

}
